-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
39 lines (29 loc) · 974 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int n, x, y, r, b, c, maior;
n = sc.nextInt();
for (int i = 0; i < n; i++) {
x = sc.nextInt();
y = sc.nextInt();
r = (int) (Math.pow(3 * x, 2) + Math.pow(y, 2));
b = (int) ((2 * Math.pow(x, 2)) + Math.pow(5 * y, 2));
c = (int) ((-100 * x) + Math.pow(y, 3));
if (r > b && r > c)
maior = r;
else if (b > r && b > c)
maior = b;
else
maior = c;
if (maior == r)
System.out.println("Rafael ganhou");
else if (maior == b)
System.out.println("Beto ganhou");
else
System.out.println("Carlos ganhou");
}
sc.close();
}
}